package main

import (
	"fmt"
)

func Count(ch chan int, i int) {

	fmt.Println("before ", i)
	ch <- 1
	close(ch)
	fmt.Println("after ", i)
}

func main1() {
	s := make([]chan int, 10)

	for i := 0; i < 10; i++ {

		s[i] = make(chan int)
		go Count(s[i], i)
	}

	for _, ch := range s {
		<-ch
	}

}

func main() {
	ch := make(chan int)
	close(ch)
	<-ch
	<-ch
	fmt.Println("read on closed channel")
	ch <- 1
}
